#pragma once 

#include<iostream> 

namespace Cherry{
template<class Iterator,class Ref,class Ptr>
  class Reverse_iterator{
  public:
  
    typedef Reverse_iterator<Iterator,Ref,Ptr> self;

    Reverse_iterator(const Iterator&it)
      :_current(it){}//构造函数，利用一个正向迭代器构造

    self& operator++()
    {
       --_current;
       return *this;
    }

    self& operator--()
    {
      ++_current;
      return *this;
    }

    bool operator!=(const self& it){
      return _current!=it._current;//终归也是比较正向迭代器
    }

    Ref operator*(){
      Iterator tmp = _current;
      return *--tmp;
    }
  private:
    Iterator _current;//正向迭代器
  };
}
